<?php
/**
 *title
 * @author: lican<364548233@qq.com>
 *Date: 2021/2/23
 *Time: 14:13
 */
namespace App\Http\Services;

use App\Http\Helpers\Http;

class KnowledgeService{

    /**
     *title
     * @author: lican<364548233@qq.com>
     */
    public static function getById($id, $keyword = ''){
        $url = "http://9.135.13.105:81/web/knowledge/getById";
        $http = new Http();
        $data = $http->post($url, ['id' => $id, 'keyword' => $keyword]);
        return $data;
    }

    /**
     *知识列表
     * @author: lican<364548233@qq.com>
     */
    public static function list($type = 0, $keyword = ''){
        $url = "http://9.135.13.105:81/web/knowledge/getBrief";
        $http = new Http();
        $brief = $http->get($url);
        $data = [
            'list' => [],
            'brief' => $brief
        ];
        if(!isset($type) && empty($keyword)){
            return $data;
        }
        $url = "http://9.135.13.105:81/web/knowledge/webKnowledge";
        $data['list'] = $http->post($url, ['type' => $type, 'keyword' => $keyword]);
        return $data;
    }

}
